#{extends 'main.html' /} #{set title:'Home' /}

<!-- Heidi ElToukhy
This is a page for the registeredUser to view the list of received requests to join his communityLists with two buttons beside
each request to either accept it or reject it-->
<body style="background-color: White;">
<body>
	<h2
		style="background-color: #FF6600; font-family: Arial; font-size: 20px">
		<p style="color: white;">
			<i>Your CommunityLists Request:</i>
		</p>
	</h2>

	#{ifnot communityRequests}
	<p
		style="background-color: #778899; width: 300px; text-align: top; font-size: 20px;">
		You Have No Communitylist Requests !!</p>
	#{/ifnot}

	<table width="300" id="dataTable" background="lightblue" ; border="2"
		; BORDERCOLOR=#FF6600>
		<tr>
			<th
				style="background-color: #778899; font-family: Arial; font-size: 20px"><p
					style="color: white;">Request</p></th>
			<th
				style="background-color: #778899; font-family: Arial; font-size: 20px"><p
					style="color: white;">Action</p></th> #{list items:communityRequests,as:'commListRequests'}
		</tr>
		<td>
			<ul>
				<li><h4>
						Request From:
						${models.RegisteredUser.findById(commListRequests.requesterID).name}
						<br>
					</h4>
				</li>
			</ul>
			<ul>
				<li><h4>To Join The Community List:
						${models.CommunityList.findById(commListRequests.CommListId).name}</h4>
				</li>
			</ul>
		</td>
		<td>
			<!-- Begin @author Nada
		Those buttons are for accepting/rejecting communitylist requests -->
			<form action="@{Application.accept()}" method="GET">
				<div id="${commListRequests.id}">
					<button name="accept" type="submit" value="${commListRequests.id}">Accept</button>
				</div>
				<hr>
			</form>
		</td>
		<td>
			<div id="${commListRequests.id}">
				<br>
				<form action="@{Application.reject()}" method="GET">
					<div id="${commListRequests.id}">
						<button name="reject" type="submit" value="${commListRequests.id}">Reject</button>
				</form>
				<!-- End @author Nada -->
			</div>
			<hr>
		</td> #{/list}
	</table>

	<br>
	<form>
		<li><a href="@{Application.viewProfile()}">Back to Profile
				Page</a></li>
	</form>
	<br>


</body>
